import { createApp } from 'vue'
import ElementPlus from 'element-plus'
import './styles/index.css'
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import { createRouter, createWebHashHistory, RouterView } from 'vue-router'

// 导入问卷预览组件
import QuestionPreview from './views/questionPreview/index.vue'

// 创建预览专用路由
const routes = [
  {
    path: '/',
    name: 'questionPreview',
    component: QuestionPreview,
    meta: {
      title: '问卷预览'
    }
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

// 创建Vue应用实例，使用RouterView组件而不是模板字符串
const app = createApp(RouterView)

// 注册Element Plus
app.use(ElementPlus)

// 注册Element Plus图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

// 注册路由
app.use(router)

// 挂载应用
app.mount('#app')
